import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
      home: Scaffold(
          appBar: AppBar(title: const Text('nihao')), body: const MyApp())));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  // 容器组件Container
  Widget build(BuildContext context) {
    return Center(
        // container容器,相当于div
        child: Container(
      // 设置文字居中
      alignment: Alignment.center,
      width: 100,
      height: 100,
      // 容器的背景颜色
      decoration: BoxDecoration(
        color: Colors.red,
        border: Border.all(
          color: Colors.black,
        ),
        borderRadius: BorderRadius.circular(10),
        boxShadow: const [BoxShadow(color: Color.fromARGB(146, 187, 20, 39))],
        // 背景色渐变
        gradient: const RadialGradient(colors: [Colors.red, Colors.yellow]),
      ),
      child: const Text('你好flutter',
          style: TextStyle(color: Colors.white, fontSize: 20)),
    ));
  }
}
